Home

Operator Usage

Name

sort-by

Description

sort-by[op] input-seq
sort the superpositions in input-seq with respect to op applied to the kets in those superpositions
if you wish to reverse sort, then use the reverse operator


Examples

-- learn some knowledge:
age |Fred> => |47>
age |Sam> => |43>
age |Rob> => |29>
age |Emma> => |26>

-- now sort them:
sort-by[age] split[" "] |Rob Sam Emma Fred>
    |Emma> + |Rob> + |Sam> + |Fred>

-- reverse sort them:
reverse sort-by[age] split[" "] |Rob Sam Emma Fred>
    |Fred> + |Sam> + |Rob> + |Emma>


See also

Operator type

core compound context